﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.PowerShell;
using System.Management.Automation.Host;
using System.Reflection;
using System.Globalization;
using System.Threading;
using System.Management.Automation.Runspaces;

namespace NEmuVirtualHost.CommandLine
{
    public sealed class ServerShell : PSHost
    {
        private Guid m_InstanceGuid;
        private CultureInfo m_CurrentCulture;
        private CultureInfo m_CurrentUICulture;
        private ConsoleUserInterface m_CurrentUI;

        public ServerShell()
        {
            m_InstanceGuid = Guid.NewGuid();
            m_CurrentCulture = Thread.CurrentThread.CurrentCulture;
            m_CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
            m_CurrentUI = new ConsoleUserInterface();
        }

        public override CultureInfo CurrentCulture
        {
            get { return m_CurrentCulture; }
        }

        public override CultureInfo CurrentUICulture
        {
            get { return m_CurrentUICulture; }
        }

        public override void EnterNestedPrompt()
        {
            throw new NotSupportedException();
        }

        public override void ExitNestedPrompt()
        {
            throw new NotImplementedException();
        }

        public override Guid InstanceId
        {
            get { return m_InstanceGuid; }
        }

        public override string Name
        {
            get { return "NEmu Virtual Host Server PowerShell Host"; }
        }

        public override void NotifyBeginApplication()
        {
            throw new NotImplementedException();
        }

        public override void NotifyEndApplication()
        {
            throw new NotImplementedException();
        }

        public override void SetShouldExit(int exitCode)
        {
            throw new NotImplementedException();
        }

        public override PSHostUserInterface UI
        {
            get { return m_CurrentUI; }
        }

        public override Version Version
        {
            get { return Assembly.GetExecutingAssembly().GetName().Version; }
        }
    }
}
